#!/usr/bin/bash

# test for searchpattern as argument to script
if [[ $# !=  1 ]]; then 
	printf "\n\twrong usage, add searchpattern for recipe\n\n"
	exit 1
fi 

# function for lynx 
glynx() {
	lynx -dump -listonly "$1" | \
		grep recipes | \
		grep -v 'lang\|redirect\|order\|recipes$'
}

#variables with 
url=https://notabug.org/dragora/dragora/src/master/recipes
rp="$1" # recipe pattern
mapfile -t v < <(glynx "$url")

# main stuff
for i in "${v[@]}"; do 
	        i=${i#*. }
		glynx "$i" | grep "$rp"
done 




